<template>
  <div class="activity">
      <Tabs :value="tabs[tabs_index].name" @on-click="changeTabs">
          <TabPane v-for="item in tabs" :label="item.label" :name="item.name">
              <template v-if="item.name == 'activity-basic'">
                  <activityBasic></activityBasic>
              </template>
              <template v-else-if="item.name == 'activity-setting'">
                  <activitySetting></activitySetting>
              </template>
              <template v-else>
                  <activityExplain></activityExplain>
              </template>
          </TabPane>
      </Tabs>
  </div>
</template>

<script>
import activityBasic from '../activityBasic/activity-basic.vue';
import activitySetting from '../activitySetting/activity-setting.vue';
import activityExplain from '../activityExplain/activity-explain.vue';
export default {
  name: 'activity',
  data(){
    var self = this;
    return {
        activity_id:0,
        person_id:0,
        tabs:[
            {
                name:'activity-basic',
                label:'基本信息'
            },
            {
                name:'activity-setting',
                label:'活动配置'
            },
            {
                name:'activity-explain',
                label:'活动说明'
            }
        ],
        tabs_index:0
    }
  },
    components:{
        activityBasic,
        activitySetting,
        activityExplain
    },
    created(){
      this.activity_id = sysinfo.activity_id;
      for(let i=0;i<this.tabs.length;i++){
          if(this.tabs[i].name == this.$route.name){
              this.tabs_index = i;
              break;
          }
      }
    },
  methods:{
      //点击tabs
      changeTabs(value){
          this.$router.push({name:value});
      }
  }
}
</script>

<style scoped>

</style>
